package com.example.safeassistan.home.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.safeassistan.R;
import com.example.safeassistan.base.BaseActivity;

public class DevicerepairProgress extends BaseActivity implements View.OnClickListener {
    private TextView  tvRepair,tvFinish;
    private LinearLayout llRepairPlan;
    private int type=1;

    public static void actionStart(Context context,int type) {
        Intent intent = new Intent(context, DevicerepairProgress.class);
        intent.putExtra("type",type);
        context.startActivity(intent);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tvRepair:
                //报修
                DeviceRepairPlan.actionStart(getContext());
                break;
            case R.id.tvFinish:
                //完成
                break;
        }
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        setAndroidNativeLightStatusBar(true);
    }

    @Override
    protected int setLayoutResourceID() {
        return R.layout.device_repair_progress;
    }

    @Override
    protected void initView() {
        setTitleText("报修进程");
        type=getIntent().getIntExtra("type",1);

        tvRepair=findViewById(R.id.tvRepair);
        llRepairPlan=findViewById(R.id.llRepairPlan);
        tvFinish=findViewById(R.id.tvFinish);
        llRepairPlan.setOnClickListener(this::onClick);
        tvRepair.setOnClickListener(this::onClick);
        switch (type){
            case 1:
                tvRepair.setVisibility(View.VISIBLE);
                llRepairPlan.setVisibility(View.GONE);
                tvFinish.setVisibility(View.GONE);
                break;
            case 2:
                tvRepair.setVisibility(View.GONE);
                llRepairPlan.setVisibility(View.VISIBLE);
                tvFinish.setVisibility(View.VISIBLE);
                break;
        }
    }

    @Override
    protected void initData() {

    }

    @Override
    protected int getTitleBarType() {
        return 0;
    }
}
